namespace CSharpPro1._0925;

public class Demo
{
    //属性
    private string name;
    //方法
    //作业1：判断闰年
    public bool IsLeapYear(int year)
    {
        if (year % 100 == 0)
        {
            return year % 400 == 0;
        }
        else
        {
            return year % 4 == 0;
        }
    }

    public bool IsLeapYear2(int year)
    {
        // bool flag = (year % 4 == 0 && year % 100 != 0 || year % 400 ==0 );
        bool flag = false;
        if (year % 100 == 0 && year % 400 == 0)
        {
            flag = true;
        }else if (year % 4 == 0 && year % 100 != 0)
        {
            flag = true;
        }
        return flag;
    }

    //课堂练习
    public void TestPrint()
    {
        Console.WriteLine("请输入一个三位数: ");
        int num = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine(num / 100);
        Console.WriteLine(num % 100 /10);
        Console.WriteLine(num % 10 / 10);
        Console.WriteLine(num % 10);
    }
    
    //作业2：旅游价格计算
    public double TravelPrice(int month, int type)//传入旅游月份，出行方式：航班传入1，动车传入2
    {
        int price = 8800;
        //旺季
        if (month >= 5 && month <= 10)
        {
            if (type == 1)//航班出行
            {
                return price * 0.9;
            }
            else  if (type == 2)//动车出行
            {
                return price * 0.75;
            }
        }
        //淡季
        else
        {
            if (type == 1)//航班出行
            {
                return price * 0.6;
            }else if (type == 2)//动车出行
            {
                return price * 0.3;
            }
        }
        //传入数据不合理，返回-1
        return -1;
    }
    //
}